<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${site.name }</title>
<meta name="description" content="${site.description }" />
<meta name="keywords" content="${site.keywords}" />
<jsp:include page="../../../inc/js.jsp"></jsp:include>
<jsp:include page="../../../inc/css.jsp"></jsp:include>
<script type="text/javascript">
	function movePage(pageNo) {
		window.location = '?classid=${param.classid}&pageNo=' + pageNo + param();
	}
	function param() {
		var param = "";
		if ($("#title").val() != "")
			param += '&title=' + $("#title").val();
		return param;
	}
	$(function() {
		$("#search").button().click(function() {
			movePage(1);
		});
		$("#add").button().click(function() {
			location.href = "newsForm.do?classid=${param.classid }";
		});

	});
	function del(id){
		if(confirm('确认删除？')){
			$.ajax( {
				type : "get",
				url : "deleteNews.do",
				data : {
					id : id
				},
				dataType:'json',
				error : function() {
					alert("加载错误");
				},
				success : function(data) {
					if(data.success){
						alert('操作成功！');
						location='?classid=${param.classid}&pageTitle=${param.pageTitle}';
					}else alert('操作失败！\r\n'+data.err);
				}
			});
		}
	}
	$(function(){
		$.get("topNewsList.do?classid=99&"+Math.random(), function(data) {
			$("#topNewsList").append(data);
		});
	});
</script>
</head>
<body>
<jsp:include page="../../../head.jsp"></jsp:include>
<div class="container">
<div class="header"></div>

<div class="mainContent">
<div class="content">
<jsp:include page="../../../inc/menuPath.jsp">
	<jsp:param value="${url}" name="url"/>
</jsp:include>
<table class="list" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<td class="search"><label> 标题： </label> <input type="text" name="title" id="title" value="${param.title }" />
			<button id="search">查询</button>
			<!--<c:if test="${admin!=null}"> <button id="add">添加</button></c:if>--></td>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="e" items="${o.dataList}" varStatus="s">
			<tr>
				<td><img src="lib/images/menu-arrow-right.png"/> <a href="news.do?id=${e.id}" target="_blank">${e.title}</a> 
				<span class="date" style="float: right;margin-right: 10px;"><fmt:formatDate value="${e.createTime}" pattern="yyyy/MM/dd" />
					浏览：${e.views }
					<!--<c:if test="${admin!=null}">
						<a href="newsForm.do?id=${e.id }" target="_blank"><img src="lib/images/write.png"/></a>
						<a href="javascript:del(${e.id});"><img src="lib/images/close.gif"/></a></c:if>-->
					</span> 
					</td>
			</tr>
		</c:forEach>
	</tbody>
	<tfoot>
		<tr>
			<td>${o.pageNav }</td>
		</tr>
	</tfoot>
</table>
</div>
<div class="sidebar">
	<div class="box">
		<h1 class="line"><a href="news.do?classid=99&pageTitle=新闻公告">新闻公告</a></h1>
		<div id="topNewsList"></div>
	</div>
	<jsp:include page="../../../advRight.jsp"></jsp:include>
</div>
</div>
</div>
<jsp:include page="../../../foot.jsp"></jsp:include>
</body>
</html>